/*using System.Collections.Generic;
using FireStarterModeller.BO;
using FireStarterModeller.Test.BO;
using FireStarterModeller.UI;
using Habanero.BO;
using Habanero.Faces.Base;
using NUnit.Framework;

namespace FireStarterModeller.Test.UI
{
    [TestFixture]
    public class TestCreateGridFilterWizardController
    {
        [SetUp]
        public void SetupTest()
        {
            //Runs every time that any testmethod is executed
            UITestUtils.SetupTest();
        }

        [TestFixtureSetUp]
        public void TestFixtureSetup()
        {
            //Code that is executed before any test is run in this class. If multiple tests
            // are executed then it will still only be called once
            UITestUtils.SetupFixture();
        }

        [TearDown]
        public void TearDownTest()
        {
            //runs every time any testmethod is complete
        }

        [Test]
        public void Test_ConstructCreateGridFilterController()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            CreateViewWizardController wizardController = new CreateViewWizardController();
            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(IWizardController), wizardController);
            Assert.AreEqual(2, wizardController.StepCount);
            Assert.IsInstanceOf(typeof(SelectPropertiesWizardStep), wizardController.GetFirstStep());
            Assert.IsInstanceOf(typeof(SelectPropertiesFilterWizardStep), wizardController.GetNextStep());
        }

        [Test]
        public void Test_SetClass_ShouldSetClassToWizardStep()
        {
            //---------------Set up test pack-------------------
            CreateViewWizardController wizardController = new CreateViewWizardController();
            SelectPropertiesWizardStep propertiesWizardStep1 =
                (SelectPropertiesWizardStep)wizardController.GetFirstStep();
            SelectPropertiesFilterWizardStep propertiesWizardStep2 =
                (SelectPropertiesFilterWizardStep)wizardController.GetNextStep();
            DMSolution solution = TestUtilsDMSolution.CreateSavedDMSolutionWithTwoClasses();
            DMClass dmClass = solution.AllClasses[1];
            dmClass.Properties.CreateBusinessObject().PropertyName = TestUtilsShared.GetRandomString();
            dmClass.Properties.CreateBusinessObject().PropertyName = TestUtilsShared.GetRandomString();
            //---------------Assert Precondition----------------
            Assert.IsNull(wizardController.Class);
            Assert.IsNull(propertiesWizardStep1.SelectedClass);
            Assert.AreNotSame(propertiesWizardStep1, propertiesWizardStep2);
            //---------------Execute Test ----------------------
            wizardController.Class = dmClass;
            //---------------Test Result -----------------------
            Assert.IsNotNull(wizardController.Class);
            Assert.IsNotNull(propertiesWizardStep1.SelectedClass);
            Assert.IsNotNull(propertiesWizardStep2.SelectedClass);
        }

        [Test]
        public void Test_SetSolution_ShouldSetSolutionToWizardStep()
        {
            CreateViewWizardController wizardController = new CreateViewWizardController();
            SelectPropertiesWizardStep propertiesWizardStep =
                (SelectPropertiesWizardStep)wizardController.GetFirstStep();
            SelectPropertiesFilterWizardStep propertiesWizardStep2 =
                (SelectPropertiesFilterWizardStep)wizardController.GetNextStep();
            DMSolution solution = TestUtilsDMSolution.CreateSavedDMSolutionWithTwoClasses();

            DMClass dmClass = solution.AllClasses[1];
            dmClass.Properties.CreateBusinessObject();
            dmClass.Properties.CreateBusinessObject();
            //---------------Assert Precondition----------------
            Assert.IsNull(wizardController.Solution);
            Assert.IsNull(propertiesWizardStep.Solution);
            Assert.AreNotSame(propertiesWizardStep, propertiesWizardStep2);
            //---------------Execute Test ----------------------
            wizardController.Solution = solution;
            //---------------Test Result -----------------------
            Assert.IsNotNull(wizardController.Solution);
            Assert.IsNotNull(propertiesWizardStep.Solution);
            Assert.IsNull(propertiesWizardStep2.Solution);
            Assert.AreSame(solution, wizardController.Solution);
            Assert.AreSame(solution, propertiesWizardStep.Solution);
        }

        [Test]
        public void Test_SelectClassForGridCreator_ShouldSetClassForGridFilterCreator()
        {
            //---------------Set up test pack-------------------
            CreateViewWizardController wizardController = new CreateViewWizardController();
            SelectPropertiesWizardStep gridPropSelector = (SelectPropertiesWizardStep)wizardController.GetFirstStep();
            SelectPropertiesFilterWizardStep gridFilterPropSelector =
                (SelectPropertiesFilterWizardStep)wizardController.GetNextStep();
            DMSolution solution = TestUtilsDMSolution.CreateSavedDMSolutionWithTwoClasses();
            wizardController.Solution = solution;
            //---------------Assert Precondition----------------
            Assert.IsNull(gridFilterPropSelector.Solution);
            Assert.IsNull(gridFilterPropSelector.SelectedClass);
            Assert.AreSame(solution, wizardController.Solution);
            Assert.AreSame(solution, gridPropSelector.Solution);
            //---------------Execute Test ----------------------
            DMClass selectedDMClass = solution.AllClasses[0];
            gridPropSelector.ClassSelectorControl.SelectedBusinessObject = selectedDMClass;
            //---------------Test Result -----------------------
            Assert.IsNotNull(gridFilterPropSelector.Solution);
            Assert.AreSame(selectedDMClass, gridFilterPropSelector.SelectedClass);
        }

        [Test]
        public void TestAcceptance_Finish_ShouldCreateUIGridFilterWithSelectedProperties()
        {
            //---------------Set up test pack-------------------
            CreateGridFilterWizardController wizardController = new CreateGridFilterWizardController();
            SelectPropertiesFilterWizardStep propertiesWizardStep =
                (SelectPropertiesFilterWizardStep)wizardController.GetFirstStep();

            DMSolution solution = TestUtilsDMSolution.CreateSavedDMSolutionWithTwoClasses();
            DMClass dmClass = solution.AllClasses[1];
            TestUtilsDMProperty.CreateUnsavedValidDMProperty(dmClass);
            DMProperty selectedProp = TestUtilsDMProperty.CreateUnsavedValidDMProperty(dmClass);

            wizardController.Class = dmClass;
            IMultiSelector<string> propertiesSelectorControl = propertiesWizardStep.PropertiesSelectorControl;
            propertiesSelectorControl.Model.Select(selectedProp.PropertyName);
            selectedProp.ObjectIdentity = null;
            //---------------Assert Precondition----------------
            Assert.AreEqual(2, dmClass.Properties.Count);
            Assert.IsNotNull(wizardController.Class);
            Assert.IsNull(wizardController.GridFilter);
            IList<string> availableOptions = propertiesSelectorControl.Model.AvailableOptions;
            Assert.AreEqual(1, availableOptions.Count);
            IList<string> selectedOptions = propertiesSelectorControl.SelectedOptions;
            Assert.AreEqual(1, selectedOptions.Count);
            Assert.IsFalse(selectedProp.IsPartOfObjectIdentity);
            //---------------Execute Test ----------------------
            wizardController.Finish();
            //---------------Test Result -----------------------
            UIGridFilter gridFilter = wizardController.GridFilter;
            Assert.IsNotNull(gridFilter);
            BusinessObjectCollection<UIGridFilterProp> gridFilterProps = gridFilter.UIGridFilterProps;
            Assert.AreEqual(1, gridFilterProps.Count);
            UIGridFilterProp gridFilterProp = gridFilterProps[0];
            Assert.AreSame(selectedProp.PropertyName, gridFilterProp.PropertyName);
        }

        [Test]
        public void TestAcceptance_Finish_ShouldCreateUIGridAndUIGridFilterWithSelectedProperties()
        {
            //---------------Set up test pack-------------------
            CreateViewWizardController wizardController = new CreateViewWizardController();
            IWizardControl wzrdControl = GlobalUIRegistry.ControlFactory.CreateWizardControl(wizardController);
            wzrdControl.Start();
            SelectPropertiesWizardStep gridPropSelector = (SelectPropertiesWizardStep)wizardController.GetFirstStep();

            DMSolution solution = TestUtilsDMSolution.CreateSavedDMSolutionWithTwoClasses();
            DMClass dmClass = solution.AllClasses[1];
            TestUtilsDMProperty.CreateUnsavedValidDMProperty(dmClass);
            DMProperty selectedProp = TestUtilsDMProperty.CreateUnsavedValidDMProperty(dmClass);

            wizardController.Class = dmClass;
            IMultiSelector<string> propertiesMultiSelectorControl = gridPropSelector.PropertiesSelectorControl;
            propertiesMultiSelectorControl.Model.Select(selectedProp.PropertyName);
            selectedProp.ObjectIdentity = null;
            selectedProp.KeepValuePrivate = false;
            //---------------Assert Precondition----------------
            Assert.AreSame(dmClass, wizardController.Class);
            Assert.AreEqual(0, dmClass.UIViews.Count);
            Assert.IsNull(wizardController.GridFilter);
            IList<string> availableOptions = propertiesMultiSelectorControl.Model.AvailableOptions;
            Assert.AreEqual(1, availableOptions.Count);
            IList<string> selectedOptions = propertiesMultiSelectorControl.SelectedOptions;
            Assert.AreEqual(1, selectedOptions.Count);
            Assert.IsFalse(selectedProp.IsPartOfObjectIdentity);
            Assert.IsFalse(selectedProp.KeepValuePrivate.Value);
            SelectPropertiesFilterWizardStep gridFilterPropSelector = wizardController.SelectFilterPropertiesWizardStep;
            Assert.AreEqual
                (dmClass.Properties.Count, gridFilterPropSelector.PropertiesSelectorControl.Model.AvailableOptions.Count,
                 "Should have all the Classes Properties available");
            Assert.IsTrue(wizardController.IsFirstStep());
            //---------------Execute First Step ----------------------
            wzrdControl.NextButton.PerformClick();
            //---------------Assert Results First Step ---------------
            Assert.IsFalse(wizardController.IsFirstStep());
            //Should Set the Available Options in the Grid Filter to the columns
            // selected in the Grid.
            Assert.AreEqual(1, gridFilterPropSelector.PropertiesSelectorControl.Model.AvailableOptions.Count);

            //--------------Select the Property ----------------------
            IMultiSelector<string> filterPropertiesMultiSelectorControl =
                gridFilterPropSelector.PropertiesSelectorControl;
            filterPropertiesMultiSelectorControl.Model.Select(selectedProp.PropertyName);

            //--------------Assert Preconditions to Finishd-------------
            IList<string> selectedFilterProps = propertiesMultiSelectorControl.SelectedOptions;
            Assert.AreEqual(1, selectedFilterProps.Count);
            Assert.IsNull(wizardController.UIGrid);
            Assert.IsNull(wizardController.GridFilter);

            //--- Execute Second Step (Finish Wizard) ----------------
            wzrdControl.NextButton.PerformClick();
            //----Assert Results Second Step--------------------------
            //Should Create Grid with selected property
            UIGridInfo grid = wizardController.UIGrid;
            Assert.IsNotNull(grid);
            Assert.IsNotNull(grid.UIGridFilter);
            Assert.AreEqual(1, grid.UIColumns.Count);
            //Should Create Grid Filter with Selected Properties.
            Assert.IsNotNull(wizardController.GridFilter);
            UIGridFilter gridFilter = wizardController.GridFilter;
            Assert.AreSame(grid.UIGridFilter, gridFilter);
            Assert.AreEqual(1, gridFilter.UIGridFilterProps.Count);

            //-----------------Verify That A UIView is created for the Class with
            //  The appropriate Grid and Form Infos
            Assert.AreEqual(1, dmClass.UIViews.Count);
            UIView uiView = dmClass.UIViews[0];
            Assert.IsNotNull(uiView.UIGridInfo);
            Assert.AreSame(grid, uiView.UIGridInfo);
            Assert.IsNotNull(uiView.UIFormInfo);
            Assert.AreEqual(2, uiView.UIFormInfo.UIFields.Count);
        }

        //TODO: if no filter props are selected should not create filter def
        //TODO: If no grid props are selected should not create grid def.

        
    }
}*/